using System;
using System.Collections.Generic;


namespace IGlobalist.Cms.Model
{
    public class OrderLine : CmsObject, IOrderLine
    {
        #region IOrderLine Members

        public long OrderID
        {
            get
            {
                return Convert.ToInt64(GetExtPropertyValue("OrderID"));
            }
            set
            {
                SetExtPropertyValue("OrderID", value);
            }
        }

        public long ProductID
        {
            get
            {
                return Convert.ToInt64(GetExtPropertyValue("ProductID"));
            }
            set
            {
                SetExtPropertyValue("ProductID", value);
            }
        }

        public int Quantity
        {
            get
            {
                return Convert.ToInt32(GetExtPropertyValue("Quantity"));
            }
            set
            {
                SetExtPropertyValue("Quantity", value);
            }
        }

        public double Price
        {
            get
            {
                return Convert.ToDouble(GetExtPropertyValue("Price"));
            }
            set
            {
                SetExtPropertyValue("Price", value);
            }
        }

        public double SalePrice
        {
            get
            {
                return Convert.ToDouble(GetExtPropertyValue("SalePrice"));
            }
            set
            {
                SetExtPropertyValue("SalePrice", value);
            }
        }

        public double Total
        {
            get
            {
                double fPrice = (SalePrice > 0 && SalePrice < Price) ? SalePrice : Price;
                return fPrice * Quantity;
            }
            
        }

        #endregion
    }
}
